package com.shopping_back.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shopping_back.pojo.entity.GroupbuyGroup;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface GroupbuyGroupMapper extends BaseMapper<GroupbuyGroup> {
    @Select("SELECT COUNT(*) > 0 FROM groupbuy_group WHERE invite_code = #{inviteCode}")
    boolean existsByInviteCode(@Param("inviteCode") String inviteCode);

    @Select("SELECT * FROM groupbuy_group WHERE invite_code = #{inviteCode} LIMIT 1")
    GroupbuyGroup findByInviteCode(@Param("inviteCode") String inviteCode);
}

